package org.apache.rocketmq.client.java.impl;

import apache.rocketmq.v2.Language;
import apache.rocketmq.v2.UA;
import org.apache.rocketmq.client.java.misc.MetadataUtils;
import org.apache.rocketmq.client.java.misc.Utilities;



public class UserAgent {
    public static final UserAgent INSTANCE = new UserAgent(MetadataUtils.getVersion(), Utilities.getOsDescription(),
            Utilities.hostName());

    private final String version;
    private final String platform;
    private final String hostName;

    private UserAgent(String version, String platform, String hostName) {
        this.version = version;
        this.platform = platform;
        this.hostName = hostName;
    }

    public UA toProtoBuf() {
        return UA.newBuilder()
                .setLanguage(Language.JAVA)
                //.setVersion(version)
                .setPlatform(platform)
                .setHostname(hostName)
                .build();
    }
}
